package com.zkthink.ceres.product.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.*;
import com.zkthink.base.entity.Entity;
import com.zkthink.base.entity.SuperEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.zkthink.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 蛋坑表
 * </p>
 *
 * @author JustArgo
 * @since 2020-09-11
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ceres_resource_pit")
@ApiModel(value = "ResourcePit", description = "蛋坑表")
@AllArgsConstructor
public class ResourcePit extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 名称
     */
    @ApiModelProperty(value = "名称")
    @NotEmpty(message = "名称不能为空")
    @Length(max = 32, message = "名称长度不能超过32")
    @TableField(value = "title", condition = LIKE)
    @Excel(name = "名称")
    private String title;

    /**
     * 链接
     */
    @ApiModelProperty(value = "链接")
    @NotEmpty(message = "链接不能为空")
    @Length(max = 256, message = "链接长度不能超过256")
    @TableField(value = "url", condition = LIKE)
    @Excel(name = "链接")
    private String url;

    /**
     * 路由
     */
    @ApiModelProperty(value = "路由")
    @NotEmpty(message = "路由不能为空")
    @Length(max = 256, message = "路由长度不能超过256")
    @TableField(value = "route", condition = LIKE)
    @Excel(name = "路由")
    private String route;

    /**
     * 图标
     */
    @ApiModelProperty(value = "图标")
    @NotEmpty(message = "图标不能为空")
    @Length(max = 256, message = "图标长度不能超过256")
    @TableField(value = "icon", condition = LIKE)
    @Excel(name = "图标")
    private String icon;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @NotNull(message = "排序不能为空")
    @TableField("sort")
    @Excel(name = "排序")
    private Integer sort;

    /**
     * 是否显示 1-显示 0-不显示
     */
    @ApiModelProperty(value = "是否显示 1-显示 0-不显示")
    @NotNull(message = "是否显示 1-显示 0-不显示不能为空")
    @TableField("display")
    @Excel(name = "是否显示 1-显示 0-不显示")
    private Integer display;

    /**
     * 是否删除 1-删除 0-不删除
     */
    @ApiModelProperty(value = "是否删除 1-删除 0-不删除")
    @NotNull(message = "是否删除 1-删除 0-不删除不能为空")
    @TableField("is_delete")
    @Excel(name = "是否删除 1-删除 0-不删除", replace = {"是_true", "否_false", "_null"})
    @TableLogic
    private Boolean isDelete;


    @Builder
    public ResourcePit(Long id, LocalDateTime createTime, Long createUser, LocalDateTime updateTime, Long updateUser,
                    String title, String url, String route, String icon, Integer sort,
                    Integer display, Boolean isDelete) {
        this.id = id;
        this.createTime = createTime;
        this.createUser = createUser;
        this.updateTime = updateTime;
        this.updateUser = updateUser;
        this.title = title;
        this.url = url;
        this.route = route;
        this.icon = icon;
        this.sort = sort;
        this.display = display;
        this.isDelete = isDelete;
    }

}
